﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Shapes;
using System.Windows.Media;
using System.Windows;

namespace DiagramCreator.Nodes
{
    public class NoteNode : GenericNode
    {
        public NoteNode() : base()
        {            
            this.ShapeGrid.Margin = new System.Windows.Thickness(ShapeGrid.Margin.Bottom);
            this.NewActionNode.Visibility = System.Windows.Visibility.Hidden;
            this.NewdecissionNode.Visibility = System.Windows.Visibility.Hidden;
            this.NewNoteNode.Visibility = System.Windows.Visibility.Hidden;
            this.StopNode.Visibility = System.Windows.Visibility.Hidden;
            this.StopNodeInner.Visibility = System.Windows.Visibility.Hidden;

            this.NodeTextField.FontFamily = new FontFamily("Verdana");
            this.NodeTextField.FontSize = 12.0;

            Rectangle rect = new Rectangle();
            rect.Width = double.NaN;
            rect.Height = double.NaN;
            rect.Fill = (Brush)this.Resources["NoteNodeBgFill"];
            rect.Stroke = Brushes.Black;
            rect.StrokeThickness = 1.0;
            rect.RadiusX = 0.0;
            rect.RadiusY = 0.0;

            Polygon corner = new Polygon();
            corner.Points.Add(new System.Windows.Point(0,0));
            corner.Points.Add(new System.Windows.Point(10, 0));
            corner.Points.Add(new System.Windows.Point(0, 10));
            corner.Points.Add(new System.Windows.Point(0, 0));
            corner.Fill = Brushes.White;
            corner.Width = double.NaN;
            corner.Height = double.NaN;
            
            corner.VerticalAlignment = VerticalAlignment.Top;
            corner.HorizontalAlignment = HorizontalAlignment.Left;

            Shape = rect;
            this.ShapeGrid.Children.Add(Shape);
            this.IsSizeable = true;

            this.ShapeGrid.Children.Add(corner);

            Line l = new Line();
            l.Stroke = Brushes.Black;
            l.StrokeThickness = 0.7;
            l.X1 = 0; l.X2 = 10;
            l.Y1 = 10; l.Y2 = 0;
            l.HorizontalAlignment = HorizontalAlignment.Left;
            l.VerticalAlignment = VerticalAlignment.Top;
            this.ShapeGrid.Children.Add(l);

            CanHaveMultipleChildren = false;
        }
    }
}
